package com.lyhengtongwl.zqsnews.adapter;

import android.content.Context;
import android.support.annotation.Nullable;
import android.widget.ImageView;

import com.bumptech.glide.Glide;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.lyhengtongwl.zqsnews.R;
import com.lyhengtongwl.zqsnews.entity.CatgoodsEntity;

import java.util.List;

/**
 * 分类商品适配器
 */
public class CatgoodsAdapter extends BaseQuickAdapter<CatgoodsEntity, BaseViewHolder> {

    Context mContext;

    public CatgoodsAdapter(Context ctx, @Nullable List<CatgoodsEntity> data) {
        super(R.layout.item_catgoods, data);
        this.mContext = ctx;
    }

    @Override
    protected void convert(BaseViewHolder helper, CatgoodsEntity item) {
        Glide.with(mContext).load(item.getPreviewImage())
                .into((ImageView) helper.getView(R.id.iv_img));
        helper.setText(R.id.tv_name, item.getGoodsTitle());
    }
}
